﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Cms.EntLib
{
    public class Html
    {

        public static string BuilderPage(string title, string content)
        {
            return BuilderPage(title, content, null, null);
        }
        public static string BuilderPage(string title, string content, List<string> scripts, List<string> styles)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
            sb.AppendLine("<html xmlns=\"http://www.w3.org/1999/xhtml\" >");
            sb.AppendLine("<head>");
            sb.AppendLine("<title>");
            sb.Append(title);
            if (scripts != null)
                foreach (string script in scripts)
                {
                    sb.AppendFormat("<script src=\"{0}\" type=\"text/javascript\"></script>\r\n", script);
                }
            if (styles != null)
                foreach (string style in styles)
                {
                    sb.AppendFormat("<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" />\r\n", style);
                }
            sb.AppendLine("</title>");
            sb.AppendLine("</head>");
            sb.AppendLine("<body>");
            sb.Append(content);
            sb.AppendLine("</body>");
            return sb.ToString();
        }
    }
}
